package com.iot.datasource.config;

import com.baomidou.mybatisplus.plugins.PaginationInterceptor;
import com.baomidou.mybatisplus.plugins.PerformanceInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;

/**
 * 描述: 数据库配置
 * @author: myx
 * @date: 2018/6/17
 * Copyright © 2018-hotpot. All rights reserved.
 */
@Configuration
@MapperScan("com.iot.metadata.*.mapper")
public class MybatisPlusConfig {
   /*
    * 分页插件，自动识别数据库类型
    * 多租户，请参考官网【插件扩展】
    */
   @Bean
   public PaginationInterceptor paginationInterceptor() {
      return new PaginationInterceptor();
   }
   /**
    * SQL执行效率插件
    */
   @Bean
   @Profile({"dev","test"})// 设置 dev test 环境开启
   public PerformanceInterceptor performanceInterceptor() {
      return new PerformanceInterceptor();
   }
}